package com.gls.security.server.authorization.jpa.entity;

import com.gls.starter.data.jpa.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import java.util.Set;

/**
 * 账户信息表
 *
 * @author lizhiyong
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
public class Account extends BaseEntity {

    private String username;

    private String password;

    private String mobile;

    /**
     * 用户的所有角色
     */
    @OneToMany(mappedBy = "account", cascade = CascadeType.REMOVE)
    private Set<AccountRole> accountRoles;

    private Boolean accountNonExpired = true;

    private Boolean accountNonLocked = true;

    private Boolean credentialsNonExpired = true;

    private Boolean enabled = true;

}